<?php /*a:3:{s:60:"D:\phpstudy_pro\WWW\oldi-erp\app\admin\view\index\index.html";i:1748225003;s:62:"D:\phpstudy_pro\WWW\oldi-erp\app\admin\view\public\header.html";i:1748225003;s:61:"D:\phpstudy_pro\WWW\oldi-erp\app\admin\view\public\style.html";i:1748225003;}*/ ?>

        <!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>ERP</title>

    <link rel="stylesheet" href="/static/css/element-ui@2.15.14.css">
    <script src="/static/js/vue.js"></script>
    <script src="/static/js/element-ui@2.15.14.js"></script>
    <script src="/static/js/axios.js"></script>
    <script src="/static/js/qs.js"></script>
    <script src="/static/js/config.js"></script>
    <script src="/static/js/echart.js"></script>


       
        
<style>
    html,
    body,
    #app {
        padding: 0;
        margin: 0;
    }    
    #contenr{
        padding: 0;
        margin: 10px;
    }
</style>

<body>
    <div id="app"  v-cloak>
        <div id="contenr">
        <div>
            <div>               
                <el-menu :default-active="0" class="el-menu-demo" mode="horizontal"  active-text-color="#1989fa" @select="handleSelect">
                   
                    <el-menu-item style="font-size: 25px; color:#1989fa"  @click="goHome">老I-erp后台</el-menu-item>

                        <div style="display:flex; justify-content: flex-end;" >
                    
                            <el-submenu index="4" style="width: 160px;" >
                                <template slot="title" ><i class="el-icon-user-solid" style="color: #1989fa;" ></i><?php echo htmlentities($nickname); ?></template>
                                <el-menu-item  @click="ChangePass">修改密码</el-menu-item>
                                <el-menu-item  @click="logout">退出登录</el-menu-item>
                            </el-submenu>
                        </div>
                    </el-menu>
             
            </div>
            <div style="display:flex;">
                <div style="width:200px;">
                    <el-menu default-active="2" class="el-menu-vertical-demo"   @open="handleOpen" @close="handleClose"  @select="MuenSelect"
                        style="height: calc(98vh - 61px);flex-shrink: 0;width: 200px;">
                    
                        <el-submenu :index="index" v-for="(item, index) in menu_list">                         
                            <template slot="title">
                                <i :class="item.icon"></i>
                                <span>   {{item.title}}</span>
                            </template>      
                            <el-menu-item v-for="items in item.children" :index="items.url">  {{items.title}}</el-menu-item>     
                            <!-- <el-menu-item-group title="分组2">
                                <el-menu-item index="/admin/Stroages/storageslist">仓库</el-menu-item>
                            </el-menu-item-group> -->
                            <!-- <el-submenu index="1-4">
                                <template slot="title">选项4</template>
                                <el-menu-item index="1-4-1">22</el-menu-item>
                            </el-submenu> -->
                        </el-submenu>
                    </el-menu>
                </div>
                <div class="iframe-container" style="flex:1" >
                    <iframe :src="src" scrolling="auto" frameborder="0" class="frame" style="width: 90vw;height: 90vh;" :onload="onloaded()">
                    </iframe>
                </div>
            </div>
        </div>

        <!-- 修改密码弹窗 -->
        <el-dialog title="修改密码弹窗" :visible.sync="UpdatePassVisible"  width="550px" :close-on-click-modal="false" >
            <el-form :model="addpassForm"  label-width ="100px" size="medium" label-position="left"  :rules="rules" ref="refaddForm" >
                <el-form-item prop="old_password" label="旧密码">
                    <el-input v-model="addpassForm.old_password" autocomplete="off" placeholder="请填写旧密码"></el-input>
                </el-form-item>
                <el-form-item prop="new_password" label="新密码">
                    <el-input v-model="addpassForm.new_password" autocomplete="off" placeholder="请填写新密码"></el-input>
                </el-form-item>
       
                <el-button @click="UpdatePassVisible = false">取 消</el-button>
                <el-button type="primary" @click="UpdatePass()" >确 定</el-button>
            <el-form >
        </el-dialog>
  
    </div>

    <script>
        let vm = new Vue({
            el: "#app",
            data() {
                return {
                    src: '/admin/index/home',   
                    activeIndex:1,  
                  
                    nickname:"<?php echo htmlentities($nickname); ?>",
                    menu_list:[],
                    UpdatePassVisible: false,//修改密码弹窗
                    addpassForm: {
                            token:'',
                            old_password: '',
                            new_password: '',                         
                    },
                    rules: {
                        old_password: [
                            { required: true, message: '请填写旧密码', trigger: 'blur' },
                           
                        ],
                        new_password: [
                            { required: true, message: '请填写新密码', trigger: 'blur' },
                            { min:5, max: 30, message: '长度在 5到30 个字符', trigger: 'blur' }
                        ]
                    },
                }
            },
            mounted(){        
                this.getDatalist()
            },
            methods: {
                handleSelect(e) {
                    console.log(e);
                  
                },
                MuenSelect(e){
                    console.log(e);
                    this.src=e 
                },

                handleOpen(e, keyPath) {                  
                },
                handleClose(e) {
                  
                 },
                onloaded: function (d) {
                    if (this.loading) {
                        this.loading.close()
                    }
                },
                //退出登录
                async logout(){
                    const res = await axios.get('../index/login/logout' )
                    console.log(res);
                    if (res.status !== 1){
                         return this.$message.error(res.info);
                    }
                    window.location.href = '../index/login/login';
                },
                //修改密码
                ChangePass(){
                  this.UpdatePassVisible = true;
                },
                async getDatalist() {
                    const res = await axios.post('/admin/index/index')
                        if (res.status !== 1) {
                            return this.$message.error(res.info);
                        }                  
                    this.menu_list = res.info
                    console.log(this.menu_list)  

                },
            
                //修改密码
                 async UpdatePass(){
                    this.$refs.refaddForm.validate(async valid => {
                        if (!valid) {
                            return
                        }
                        const res = await axios.post('./Index/login/changePassword', {params: this.addpassForm})
                        if (res.status !== 1) {
                            return this.$message.error(res.info);
                        }
                        this.$message.success(res.info);
                        this.UpdatePassVisible = false;
                    })
                },
                goHome(){               
                    this.src = '/admin/index/home'
                }


            }
        });
    </script>
</body>

</html>